package com.gjy.sb.controller;

import com.gjy.sb.domain.AjaxResult;
import com.gjy.sb.domain.JsonDomain;
import com.gjy.sb.exception.ParamErrorException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-01-02 15:43:19
 */
@RequestMapping("/json")
@RestController
public class JsonController {

    @PostMapping("/t1")
    public AjaxResult t1(@RequestBody @Valid JsonDomain jd) {
        return AjaxResult.builder().data(jd).build();
    }

    @PostMapping("/t2")
    public AjaxResult t2() {
        throw new ParamErrorException("t2测试");
    }

}
